/// @tags:
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

int const N = 1e2 + 5;

struct Person {
  int t, q;
} p[N];

int n, m, typ, tot;

inline int main() {
  cin >> n >> m >> typ;
  for (int i = 1; i <= n; ++i) { cin >> p[i].t; }
  for (int i = 1; i <= n; ++i) { cin >> p[i].q; }
  for (int i = 1; i <= n; ++i) {
    if (p[i].t && p[i].q) { ++tot; }
  }
  cout << min(tot, m) + n - tot;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("「MdOI R4」Fun.in", "r", stdin);
  freopen("「MdOI R4」Fun.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
